//全局计数器组件
components/CountCom.vue
<template>
<div class="example">
<button @ click=" addCount" >count++</button>{{count }}</div>
</template>
<script>
export default{
    date(){
        return{
            count:0
        }
    },
    methods:{
        addCount(){
            this.count++;
        }
    }
}
</script>
<style>
.example{
    color:red;
}
</style>